package com.example.yangguoying.SqLiteDatabase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class StudentInfoDatabase extends SQLiteOpenHelper {
    private static  final String CREATE_STUDENT_INFO_TABLE = "create table student_info (student_info_id integer primary key autoincrement, student_name text, student_num text UNIQUE, student_phone text, student_address text, " +
            "student_faculty text, student_grade text, student_class text, student_dormitory text,student_remarks text,is_upload integer)";
    private Context mContext;
    public  StudentInfoDatabase(Context context, String name, SQLiteDatabase.CursorFactory factory, int version){
        super(context, name, factory, version);
        mContext = context;

    }


    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_STUDENT_INFO_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
        sqLiteDatabase.execSQL("drop table if exists student_info");
        onCreate(sqLiteDatabase);
    }
}
